﻿using System.IO;
using Microsoft.Win32;

namespace LiveFrameworkExplorer
{
    public static class MimeTypeExtension
    {
        public static string GetMimeType(this FileInfo fileInfo)
        {
            var contentType = "application/octet-stream";
            try {
                var fileClass = Registry.ClassesRoot.OpenSubKey(fileInfo.Extension);
                contentType = fileClass.GetValue("Content Type").ToString();
            } catch { }
            return contentType;
        }
    }
}
